/**
 * 药品模块可复用的hooks函数
 */
import { getMedicalOrderDetail } from '@/api/medicine'
import type { OrderDetail } from '@/types/medicine'
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
// 获取药品订单详情数据
const useMedOrderDetail = () => {
  const route = useRoute()
  const order = ref<OrderDetail>()
  onMounted(async () => {
    const res = await getMedicalOrderDetail(route.query.orderId as string)
    console.log('药品订单详情：', res.data)
    order.value = res.data
  })
  //  提供服务（数据或函数）
  return { order }
}

export { useMedOrderDetail }
